<style lang="scss">
	/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
	@import "uview-ui/index.scss";
</style>

<script>
import request from './utils/request'
export default {
  globalData: {
    apiBase: "http://localhost:8000/",
  },
  onLaunch: function() {
    uni.login({
      provider: "weixin",
      success: function(res) {
        console.log('Login info', res.authResult);

        request.get('/wechat/mini/login', {
          code: res.code
        }).then(res => {
          if (res.token) {
            uni.setStorageSync('api_token', res.token)
            uni.setStorageSync('session_key', res.session_key)
          }
        })
      },
    });
  },
  onShow: function() {
    console.log("App Show");
  },
  onHide: function() {
    console.log("App Hide");
  },
};
</script>

<style>
/*每个页面公共css */
</style>
